<script>
$(function() {
  /* scroll plugin */
  $.scrollUp({scrollText: ''});

  /* beautify select */
  $('.selectpicker').selectpicker({width:'auto', style:'btn-default'});

  /* carousel movie cap */
  $('#movie-carousel-cap').carousel();

  /* tooltip */
  $('.tool').tooltip({placement:'right',html:true});

  /* timeline */
  var json_data = {$timeline_data};
  var loaded = false;
  $('#timeline-modal').on('shown.bs.modal', function(event) {
    if(!loaded) {
      loaded = true;
      createStoryJS({
        type:   'timeline',
        width:  '100%',
        height: '600',
        source: json_data,
        embed_id: 'timeline-body',
      });
    }
  });

  /* radar chart */
  var radar_data = {$radar_data};
  AmCharts.ready(function() {
    // RADAR CHART
    var chart = new AmCharts.AmRadarChart();
    chart.dataProvider = radar_data;
    chart.categoryField = "type";
    chart.startDuration = 2;

    // VALUE AXIS
    var valueAxis = new AmCharts.ValueAxis();
    valueAxis.axisAlpha = 0.15;
    valueAxis.minimum = 0;
    valueAxis.dashLength = 3;
    valueAxis.axisTitleOffset = 20;
    valueAxis.gridCount = 5;
    chart.addValueAxis(valueAxis);

    // GRAPH
    var graph = new AmCharts.AmGraph();
    graph.valueField = "values";
    graph.bullet = "round";
    graph.balloonText = "[[value]]";
    chart.addGraph(graph);

    // WRITE
    chart.write("radar-body");
  });
});
</script>
